package com.zzw.hj85;

import java.util.Scanner;

/**
 * @Project: hw_java
 * @Description: 最长回文子串
 * @Author: zzw
 */

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
    public static boolean isPalindromeStr(String s) {
        int left = 0;
        int right = s.length() - 1;
        while (left <= right) {
            if (s.charAt(left) != s.charAt(right)) {
                return false;
            } else {
                left++;
                right--;
            }
        }
        return true;
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String str = in.nextLine();
        int max = 0;
        outer:
        for (int i = 0; i < str.length() - 1; i++) {
            for (int j = i + 1; j < str.length(); j++) {
                String substring = str.substring(i, j + 1);
                if (isPalindromeStr(substring)) {
                    max = Math.max(substring.length(), max);
                    if (max >= str.length() / 2) {
                        break outer;
                    }
                }
            }
        }
        System.out.println(max);
    }
}